#/bin/hash               
######################
#        START      #
#####################


# INSTLLATION DETAILS
#  COPY THIS SCRIPT IN YOUR HOME DIRECTORY.  MAKE IT EXECUTABLE WITH chmod +x my.sh  COMMAND.
#  RUN THIS SCRIPT IN YOUR TERMINAL IN FULL SCREEN MODE  ./my.sh 

until [ "$selection" = "0" ]; do


###  define some colors for terminal. 
NM=`echo -e "\033[m"`
NORMAL=`echo -e "\033[m"`
MENU=`echo -e "\033[36m"` #Blue
YL=`echo -e "\033[33m"` #yellow
FGRED=`echo -e "\033[41m"` #forground is red    
RT=`echo -e "\033[31m"`
RED_TEXT=`echo -e "\033[31m"` #Text is Red 
ENTER_LINE=`echo -e "\033[33m"` 
FR=`echo -e "\033[31m"`
FC=`echo -e "\033[36m"`
FGBLUE=`echo -e "\033[35m"`
BG=`echo -e "\033[42m"`
BLACK= 	`echo -e "\033[22;30m"` # black
BLUE=`echo  -e "\033[22;34m"`

###
    


echo ""
    clear

# echo "${RED_TEXT} ==========================================================================================${NORMAL}"   
echo ""
echo "${MENU}                   Welcome To Ubuntu System Details "
echo "                                      ${NORMAL}"
# echo "${RED_TEXT} ==========================================================================================${NORMAL}" 
echo "                   ${YL} `date` "
echo ""   
echo "${BLUE}           #################################################################"
echo "           #${YL}   Choose what you need to know:                              ${BLUE} #"
echo "           #  ====================================                         #"
echo "           # 1) General Information About This Computer                    #"
echo "           # 2) The CPU Infromation                                        #"
echo "           # 3) The Memory Information                                     #"
echo "           # 4) File Systems Infromation                                   #"
echo "           # 5) PCI devices On MOtherboard information {detailed}          #"
echo "           # 6) Network Information                                        #"
echo "           #                                                               #"
echo "           # =========================================================     #"
echo "           # 7) EXIT                                                       #"
echo "           #                                                               #"
echo "           #################################################################${NORMAL}"
    echo ""
    echo -n "Choose From Above: "
    read selection
    echo ""

  case $selection in
        
              
        1 )clear 
echo "___________________________________________________________________________________"
            echo "${RED_TEXT}**** General Information About This Computer ****${NORMAL}"
            echo "___________________________________________________________________________________"
            echo "${BLUE}This Computer has  ${YL}`uname -m` architecture ;${BLUE}"     
            echo "The Linux Kernel Used on this computer ${YL}`uname -r`${BLUE}"
            echo "This Linux Distrobution Used On this computer is  ${YL}`cat /etc/issue | cut -c 1-12` ${BLUE}"
           ##  echo " `cat /etc/issue | cut -c 1-12`" 
            echo "The Host Name Of this computer is  ${YL}`hostname`${BLUE}"
            echo "The Name Of the user Of this computer is  ${YL}`whoami` ${BLUE}"
            echo "The Number Of The Users That Using This Computer  ${YL}`users | wc -w` Users ${BLUE}"
            echo "The System Uptime  =  ${YL}`uptime | awk '{ gsub(/,/, ""); print $3 }'` (Hrs:Min)${BLUE}"
            echo "The Run level Of Current OS is  ${YL}`runlevel`${BLUE}"
            echo "The Number OF Running Process : ${YL}`ps ax | wc -l`${BLUE}"
	    echo "The Last - System  Update was carried out on  :"  ${YL}
	    stat -c %y /var/lib/apt/periodic/update-success-stamp
            echo  "___________________________________________________________________________________${NORMAL}"
           # echo "Press [enter] key to continue. . ."
            echo -n "Press Enter to return to Main Menu: "
            read selection
            clear
            ;;
              
        2 )  clear
echo "___________________________________________________________________________________"
            echo "${RT}****The CPU Infromation****${NORMAL}"
            echo "___________________________________________________________________________________"

		echo "${BLUE} " 
		echo 'Your Processor is :' ${YL}`awk 'FNR == 5 { print $4,$6,$7,$8,$9,$10 }' /proc/cpuinfo`${BLUE}
	        echo 'Having Cache Size of' ${YL}`awk 'FNR == 9 { print $4,$5 }' /proc/cpuinfo`
                echo "${NORMAL}"
	       
	        echo "___________________________________________________________________________________"
	    #    echo "Press [enter] key to continue. . ."
            echo -n "Press Enter to return to Main Menu: "
            read selection
            clear
            ;;    
              
        3 ) clear 
echo "___________________________________________________________________________________"
  		echo "${RT}" 
	        echo " ****The Memory Information****${NORMAL}"
        	echo "${BLUE} "
	        echo "___________________________________________________________________________________"
		echo   'Total System  Memory ( GB ):'  ${YL} `awk '/MemTotal:/ { print $2/1048576}' /proc/meminfo`${BLUE}
	        echo "___________________________________________________________________________________"
		echo  'Used Memory (GB): '  ${YL}`free | grep Mem| awk '{print ($3)/1048576}'`${BLUE}	       
	        echo "___________________________________________________________________________________"
                echo 'Free Memory (GB):'  ${YL}`awk '/MemFree:/ { print $2/1048576}' /proc/meminfo`${BLUE}
		echo "___________________________________________________________________________________"
		echo "${NORMAL}"
            	# echo "Press [enter] key to continue. . ."
            echo -n "Press Enter to return to Main Menu: "
            read selection
            clear
            ;;
              
        4 ) clear
echo "___________________________________________________________________________________"
            echo "${RT}"
            echo "*****File Systems Infromation******${NORMAL}"
	    echo "${BLUE} "
	        echo "___________________________________________________________________________________"
	        echo "`df -h`"
	        echo "___________________________________________________________________________________"

		echo "${NORMAL}"
		# echo "Press [enter] key to continue. . ."


            echo -n "Press Enter to return to Main Menu: "
            read selection
            clear
	    ;;
	         
        5 ) clear 
echo "___________________________________________________________________________________"
            echo "${RT}"
            echo "******PCI devices On MOtherboard information {detailed}******${NORMAL}" 
            echo "${BLUE} "
            echo "___________________________________________________________________________________"
	        echo  "`lspci -tv`"   
	        echo "___________________________________________________________________________________"       
		echo "${NORMAL}"
	        # echo "Press [enter] key to continue. . ."
            echo -n "Press Enter to return to Main Menu: "
            read selection
            clear
	    ;;
	     
        6 ) clear 
echo "___________________________________________________________________________________"
            echo "${RT}"
            echo "********Network Information********${NORMAL}"
            echo "${BLUE} "
            echo "___________________________________________________________________________________"
	        echo "${YL}---->  This is Wireless WI-FI  Lan Information ${BLUE}"
	        echo "_______________________________________________________________________________"
	        echo "`/sbin/ifconfig wlan0`" 
	        echo ""
	        echo "_______________________________________________________________________________"
	        echo "${YL}---->  This is Wired Lan Information  ${BLUE}"
	        echo "_______________________________________________________________________________"
	        echo "`/sbin/ifconfig eth0`" 
	        echo "_______________________________________________________________________________"
	         echo "${YL} Checking your Internet Connectivity ... wait for a while ...${BLUE}"
	        
	        ((ping -w5 -c3 8.8.8.8 || ping -w5 -c3 4.2.2.1) > /dev/null 2>&1) && echo "Internet Is On" || (echo "No Internet" && exit 1)
	        echo "___________________________________________________________________________________"
		echo "  Your Local IP Addresses are :"
		echo ${YL}`/sbin/ifconfig | grep "inet addr" | awk -F: '{print $2}' | awk '{print $1}'`${BLUE}
		echo " Your Public IP Address is :"
		echo ${YL}`wget -qO- http://ipecho.net/plain`${BLUE}
		 echo "___________________________________________________________________________________"
		echo "${NORMAL}"	        


	        echo -n "Press Enter to return to Main Menu: "
            	read selection
            clear
	    ;;
	      
        7 ) echo "${BLUE} " 
        echo "Thank You `whoami` For Using This Script"
            read -p "Press [enter] key to EXIT .....${NORMAL}"
          
	        clear
	        exit 
	          
	    ;;
	            
        * ) echo "Ooops , You Enter A Wrong Number "
	    echo "Please , Choose a number from The menu Above from (1:7)"    #FFC0CB
            echo "Press [enter] key to try again.....${NORMAL}"
            read
            ;;
               
    esac
done
                             





                                             ##################
                                             #                #
                                             #     Thank You, #
                                             #     RUYAM      #
                                             ##################




